Calculating average atomic mass